/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.blog.city.checkthedep.sessionbeans;

import com.blog.city.checkthedep.entities.RegisteredUser;
import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;

/**
 *
 * @author Breath
 */
@Stateless
public class LoginSess implements LoginSessLocal {

    @PersistenceContext(unitName = "com.blog.city_CheckTheDep_war_1.0-SNAPSHOTPU")
    private EntityManager em;

    /**
     * 
     * @return
     */
    public EntityManager getEntityManager() {
        return em;
    }

    /**
     * 
     * @param em
     */
    public void setEntityManager(EntityManager em) {
        this.em = em;
    }

    /**
     * 
     * @param checkedUser
     * @param checkedPassword
     * @param status
     * @return
     */
    @Override
    public boolean loginUserSession(RegisteredUser checkedUser, final String checkedPassword, boolean status) {
        if ((checkedUser.getPassword().equals(checkedPassword)) && status==false) {
            status = true;
            return true;
        } else {
            return false;
        }
    }
}
